<%--
  Created by IntelliJ IDEA.
  User: zyh
  Date: 2021/11/18
  Time: 20:46
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
      integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
        integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fm" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style>
    th{
        text-align: center;
    }
</style>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <table class="table table-hover table-striped" style="text-align: center">
                <tr>
                    <td>
                        文档分类：<select id="names" >
                                <c:forEach items="${list.ecat}" var="e">
                                    <option>${e.name}</option>
                                </c:forEach>
                            </select>
                            <button class="glyphicon glyphicon-search sel"></button>
                        <a href="${ctx}/entry/index" class="btn btn-success">返回</a>
                    </td>
                    <td>
                        <a href="${ctx}/add.jsp" class="glyphicon glyphicon-plus"></a>
                    </td>
                </tr>
            </table>

            <table class="table table-bordered table-hover table-striped" style="text-align: center">
            <tr>
                <th  class="active">文档编号</th>
                <th class="success">文档名称</th>
                <th class="warning">文档摘要</th>
                <th class="danger">上传人</th>
                <th class="info" >上传时间</th>
                <th class="active">操作</th>
            </tr>
            <c:forEach items="${list.eent}" var="i">
                <tr>
                    <td class="active" name="id">${i.id}</td>
                    <td class="success">${i.title}</td>
                    <td class="warning">${i.summary}</td>
                    <td class="danger">${i.uploaduser}</td>
                    <td class="info">
                        <fm:formatDate value="${i.createdate}" pattern="yyyy-mm-dd"/>
                    </td>
                    <td class="active">
                        <a href="${ctx}/entry/upden?id=${i.id}">修改</a>
                        <button class="glyphicon glyphicon-remove del"></button>
                    </td>
                </tr>
            </c:forEach>
                <tr>
                   <td colspan="6"><span>${msg}</span></td>
                </tr>
            </table>
        </div>
    </div>
</div>

</body>
<script>
    $(function () {
        $(".del").click(function () {
            let c = $(this).parents("tr").children().first().text();
            location.href="${ctx}/entry/del?id="+c;
        })
        $(".sel").click(function () {
            let a = $("#names option:selected").text() ;
            location.href="${ctx}/entry/sel?name="+a;
        })
    })
</script>
</html>
